<?php

namespace App\Http\Requests\Api;

class UserIntegralLogsRequest extends FormRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()){
            case "POST":{
                return [
                    //用户id必须 且在用户表中有该用户
                    "user_id"=>['required',"exists:users,id"],
                    //价格 且必须为数字
                    "price"=>['required',"numeric"],
//                    "des"=>['required'],
                ];
            }
        }

    }
    public function  messages()
    {
        return [
            "user_id.required"=>"用户身份必须",
            "user_id.exists"=>"非法的用户信息",
            "price.required"=>"变动金额必须",
            "price.numeric"=>"变动金额为数字",
//            "des.required"=>"积分变动描述必须"
        ];
    }
}
